package com.quanxiaoha.weblog.admin.controller;


import com.quanxiaoha.weblog.admin.model.vo.category.AddCategoryReqVO;
import com.quanxiaoha.weblog.admin.model.vo.category.DeleteCategoryReqVO;
import com.quanxiaoha.weblog.admin.model.vo.category.GetCategoryPageListReqVO;
import com.quanxiaoha.weblog.admin.model.vo.tag.AddTagReqVO;
import com.quanxiaoha.weblog.admin.model.vo.tag.DeleteTagReqVO;
import com.quanxiaoha.weblog.admin.model.vo.tag.GetTagPageListReqVO;
import com.quanxiaoha.weblog.admin.model.vo.tag.SearchTagReqVO;
import com.quanxiaoha.weblog.admin.service.AdminCategoryService;
import com.quanxiaoha.weblog.admin.service.AdminTagService;
import com.quanxiaoha.weblog.common.aspect.ApiOperationLog;
import com.quanxiaoha.weblog.common.utils.PageResponse;
import com.quanxiaoha.weblog.common.utils.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/admin")
@Api(tags = "Admin标签模块")
@Slf4j
public class AdminTagController {

    @Autowired
    private AdminTagService adminTagService;


    @PostMapping("/tag/add")
    @ApiOperation(value = "新增标签接口")
    @ApiOperationLog(description = "新增标签接口")
    public Response addTags(@RequestBody @Validated AddTagReqVO addTagReqVO) {
        return adminTagService.addTags(addTagReqVO);
    }


    @PostMapping("/tag/list")
    @ApiOperation(value = "分页查询标签接口")
    @ApiOperationLog(description = "分页查询标签接口")
    public PageResponse getTagPageList(@RequestBody @Validated GetTagPageListReqVO getTagPageListReqVO) {
        return adminTagService.getTagPageList(getTagPageListReqVO);
    }


    @PostMapping("/tag/delete")
    @ApiOperation(value = "删除标签接口")
    @ApiOperationLog(description = "删除标签接口")
    public Response deleteTag(@RequestBody @Validated DeleteTagReqVO deleteTagReqVO) {
        return adminTagService.deleteTag(deleteTagReqVO);
    }

    @PostMapping("/tag/search")
    @ApiOperation(value = "模糊查询标签接口")
    @ApiOperationLog(description = "模糊查询标签接口")
    public Response searchTag(@RequestBody @Validated SearchTagReqVO searchTagReqVO) {
        return adminTagService.searchTags(searchTagReqVO);
    }

//
//    @GetMapping("/category/select/list")
//    @ApiOperation(value = "分类下拉列表数据获取")
//    @ApiOperationLog(description = "分类下拉列表数据获取")
//    public Response selectCategoryList(){
//        return adminCategoryService.getCategorySelectList();
//    }
}
